classdef TimeShiftFilter < Filter 
	
properties
end % end of properties

methods 

	function obj = TimeShiftFilter(Name, LoopOrder, Bandwidth, DetectorGain,...
																 IntegrationTime)
		obj = obj@Filter(Name, LoopOrder, Bandwidth, DetectorGain, IntegrationTime);
		obj.filter1 = @obj.filter1Time;
		obj.filter2 = @obj.filter2Time;
		obj.filter3 = @obj.filter3Time;
 	end	

end % end of methods 

methods (Access = protected)

	function out = filter1Time(obj, DiscriminatorOut, FrequencyShift)
		out = DiscriminatorOut * obj.Coefficients(1) +...
	 				FrequencyShift/obj.CarrierFrequency * obj.IntegrationTime;
	end

	function out = filter2Time(obj, DiscriminatorOut, FrequencyShift) % TODO
		out = DiscriminatorOut * obj.Coefficients(1) + obj.States(1);
		obj.States(1) = obj.States(1) + obj.Coefficients(1) * ...
	 									obj.Coefficients(2) * DiscriminatorOut;	
	end
	
	function out = filter3Time(obj, DiscriminatorOut, FrequencyShift) % TODO
		out = DiscriminatorOut * obj.Coefficients(1) +obj.States(1) +obj.States(2);
		obj.States(2) = obj.States(2) + obj.Coefficients(3) * obj.States(1);
		obj.States(1) = obj.States(1) + obj.Coefficients(1) * ...
	 									obj.Coefficients(2) *	DiscriminatorOut;
	end

end % end of methods

end % end of class
